<!DOCTYPE html>
<html lang="en" style="font-size:15.625vw;">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.5,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        body{
            margin:0;
        }
        div:nth-of-type(1){
            width:1.2rem;
            height:0.9rem;
            background:Red;
        }
        div:nth-of-type(2){
            width:5.2rem;
            height:0.9rem;
            background:green;
        }
        .wrapper{
            display:-webkit-box;
        }
    </style>
    <script>
        //1、建议优先使用vw单位实现rem百分比布局
        //2、REM自适应算法
        // var html = document.querySelector("html");
        // html.style.fontSize = html.offsetWidth / 640 * 100 + "px";
        // addEventListener("resize",function(){
        //     html.style.fontSize = html.offsetWidth / 640 * 100 + "px";
        // },false);


        //淘宝REM JS算法
        // var html = document.querySelector("html");
        // html.style.fontSize = html.offsetWidth / 10 + "px";
        // addEventListener("resize",function(){
        //     html.style.fontSize = html.offsetWidth / 10 + "px";
        // },false);
        // 1rem = 64px



        // 100vw = 640px
        // 1vw = 6.4px
        // 100px?vw
        // 100px/6.4px
        //
        // 15.625vw

        //
        // 100vw = 750px
        // 1vw=7.5px
        // 15.625vw * 7.5



    </script>
</head>
<body>
    <div class="wrapper">
        <div></div>
        <div></div>
    </div>
</body>
</html>
